<template>
  <div id="app">
    <video-player ref="videoPlayer"></video-player>
  </div>
</template>

<script>
import VideoPlayer from '@/components/VideoPlayer.vue'

export default {
  name: 'HomeView',
  components: {
    VideoPlayer
  },
  mounted() {
    // this.$refs.videoPlayer.play('http://49.4.21.152:40018/MTY3OTE4MTBfMF8wXzBfMF8wXzBfc3RyZWFtJldNNDY=.flv')
    this.getUrlParams(window.location.href)
  },
  methods: {
    getUrlParams(url) {
      const urlParams = new URLSearchParams(url.split('?')[1]);
      const params = {};
      for (let param of urlParams.entries()) {
        params[param[0]] = param[1];
      }
      // console.log('地址栏参数：', params);
      if (params.url) {
        this.$refs.videoPlayer.play(params.url)
      }
    }
  },
}
</script>
